/*
 * @Author: 刘润泽
 * @Date: 2023-03-14 17:42:26
 * @LastEditors: 刘润泽
 * @LastEditTime: 2023-03-14 18:06:31
 * @Description: 
 */
package server.business.converter.Converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

public class RhTypeCoverter implements Converter<String> {
    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public CellData<String> convertToExcelData(String value, ExcelContentProperty excelContentProperty,
            GlobalConfiguration globalConfiguration) throws Exception {
        if (value == null) {
            return new CellData<>("");
        } else if (value.equals("100")) {
            return new CellData<>("+");
        } else if (value.equals("101")) {
            return new CellData<>("-");
        } else if (value.equals("102")) {
            return new CellData<>("不详");
        } else{
            return new CellData<>("错误数据");
        }
    }

    @Override
    public String convertToJavaData(CellData arg0, ExcelContentProperty arg1, GlobalConfiguration arg2)
            throws Exception {
        throw new UnsupportedOperationException("Unimplemented method 'convertToJavaData'");
    }
}
